const mongoose = require('mongoose')
const Scheam = mongoose.Schema;
const UserScheam = new Scheam({
    username: {
        type: String,
        required: true
    },
    email: {
        type: String,

    },
    password: {
        type: String,
        required: true
    },
    phone: {
        type: Number,
        required: true
    },
    sex: {
        type: String,

    },
    inentity: {
        type: String,
    },
    data: {
        type: Date,
        default: Date.now,
        // set: function(date, isFull = false, connector = '-') {
        //     let __date = null;
        //     if (typeOf(date, 'number')) {
        //         __date = new Date(date);
        //     } else if (typeOf(date, 'date')) {
        //         __date = date;
        //     } else {
        //         return '';
        //     }
        //     let str = [__date.getFullYear(), __date.getMonth() + 1, __date.getDate()].map(formatNumber).join(connector);
        //     if (isFull) {
        //         str += ' ' + [__date.getHours(), __date.getMinutes(), __date.getSeconds()].map(formatNumber).join(':');
        //     }
        //     return str;
        // }
    },

})
module.exports = User = mongoose.model("users", UserScheam)